using System;
using System.Globalization;
using System.Windows.Data;
using Binding = System.Windows.Data.Binding;

namespace Haidou.Wpf.Util.Converters;

public class SelectionCountToDescription : IValueConverter
{
	public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
	{
		return value is not int count
			? Binding.DoNothing
			: count > 1 ? LocalizationHelper.GetWithFormat("S.SaveAs.Partial.Mode.Selection.Plural", "{0} frames selected.", count) :
			count == 1 ? LocalizationHelper.Get("S.SaveAs.Partial.Mode.Selection.Singular") : LocalizationHelper.Get("S.SaveAs.Partial.Mode.Selection.None");
	}

	public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
	{
		return Binding.DoNothing;
	}
}